<style type="text/css">
#countStock {
	margin-top: 10px;
}
#countStock p{
	margin-right:10px;
}
#scanForm {
	margin-bottom: 10px;
}
a,a:hover {
	text-decoration: none;
}
</style>
<div class="pageheader">
	<h2>
		<i class="fa fa-pencil-square"></i>库存管理
	</h2>
	<div class="breadcrumb-wrapper">
		<span class="label">你所在的位置：</span>
		<ol class="breadcrumb">
			<li><a href="/index">ERP管理系统</a></li>
			<li>库存管理</li>
			<li class="active">库存盘点</li>
		</ol>
	</div>
</div>
<div class="contentpanel">
<div class="main">
    <?php if (empty($this->exitlist)){ ?>
    <form id="scanForm" class="form-inline" method="post" action="/stock/inventory">
        <?php if ($this->msg):?>
        <div class="form-group"><span class="label label-warning">你提交的数据有误，请检查后再次上传</span></div>
        <?php endif;?>  
        <div class="form-group">
            <textarea placeholder="扫描或输入条形码" name="barcode" class="form-control" name="title"></textarea>
        </div>
        <div class="form-group">
            <label for="sku"> 日期：</label><?php echo date("Y-m-d");?>
        </div>
        <button type="submit" class="btn btn-primary">确定</button>
        <div class="form-group"><span class="text-danger"><?php if($this->msg=='success'){echo '加入库存成功';}else if($this->msg=='fail'){echo '加入库存失败';}?></span></div>
    </form>
    <?php } ?>
    
    <form id="updateInventory" method="post" action="/stock/submitinventory">
         <?php 
         if ($this->exitlist){
         ?>
        <div class="form-group">
            <input placeholder="这是属于第几次盘点(请填阿拉伯数字)" name="times" class="form-control" name="title">
        </div>
        <?php }?>
        <div class="table-responsive">
            <table class="table table-bordered table-hover">
                <thead>
                    <tr>
                        <th>SKU</th>
                        <th>产品名称</th>
                        <th>尺码</th>
                        <th>本次扫描值</th>
                        <th>系统库存实际值</th>
                        <th>永不下架</th>
                    </tr>
                </thead>
                <tbody>      
                    <?php 
                    if ($this->exitlist){
                    	foreach ($this->exitlist as $v){ 
                    		//if($v['t_value'] != $this->sizeid[$v['id']]){
                    ?>
                    <tr>
                        <td>
                            <a target="_blank" href="/stock/update?id=<?php echo $v['stock_id'];?>"><?php echo $v['sku'];?></a>
                            <input type="hidden" name="sku[]" value="<?php echo $v['sku']; ?>">
                        </td>
                        <td>
                            <?php echo $v['title'];?>
                            <input type="hidden" name="title[]" value="<?php echo $v['title']; ?>">
                        </td>
                        <td>
                            <?php echo $v['size'];?>
                            <input type="hidden" name="size[]" value="<?php echo $v['size']; ?>">
                        </td>
				        <td>
                            <input type="hidden" name="sizevalueid[]" value="<?php echo $v['id']; ?>">
                            <input type="hidden" name="inventoryvalue[]" value="<?php echo $this->sizeid[$v['id']]; ?>">
				            <?php echo $this->sizeid[$v['id']]; ?></td>
				        <td><?php echo $v['t_value']; ?></td>
				        <td><?php echo $v['is_forlong']?'是':'否'; ?></td>
			        </tr>
			        <?php 
                    		//}
                    	} 
                    }
                   ?>
		        </tbody>
            </table>
        </div>
        <?php if ($this->exitlist){ ?>
        <input class="btn btn-primary" type="submit" value="提交本次盘点下的本次扫描结果">
        <!-- <a href="/missingstock.csv" class="btn btn-primary">导出Excel：系统记录存在但仓库不存在的库存值</a> -->
	    <?php } ?>
    </form>
</div>
</div>
